Closing a Discussion

I have a piece of script closing a opened discussion : 

Discussion SDiscussion
Object obj
string smess= "Discussion closed"
Comment scomm
if (SDiscussion.status == "Open") {
closeDiscussion (SDiscussion, obj, smess, scomm)
}

But, as I run the script there is an error : unassigned variable (SDiscussion) !!

How are Discussions declared ?


Estebell - Mon Oct 21 11:07:27 EDT 2013

Re: Closing a Discussion
llandale - Mon Oct 21 14:23:36 EDT 2013

You have done equivalently  this, which is obviously wrong.  You declare "o" but fail to set it to a value.  If you set it to null you'd get a "null Object parameter" error.

  • Object o
  • if (o."Object Text" "" == "Something")

I don't use "Discussions", but this looks like a way to get a Handle on Discussions:

  • Discussion d
  • for d in obj do     // or Project/Folder/Module

-Louie

Re: Closing a Discussion
Estebell - Tue Oct 22 09:22:17 EDT 2013

llandale - Mon Oct 21 14:23:36 EDT 2013

You have done equivalently  this, which is obviously wrong.  You declare "o" but fail to set it to a value.  If you set it to null you'd get a "null Object parameter" error.

  • Object o
  • if (o."Object Text" "" == "Something")

I don't use "Discussions", but this looks like a way to get a Handle on Discussions:

  • Discussion d
  • for d in obj do     // or Project/Folder/Module

-Louie

This is my corrected code :

Discussion SDiscussion
string smess = "La discussion en cours sera close"
Comment scomm
Object obj
 
for SDiscussion in obj do{
closeDiscussion (SDiscussion, obj, smess, scomm)
}
 
It runs without error, but the discussion is not closed yet!!
 
 

Re: Closing a Discussion
sekrbo - Tue Oct 22 09:51:01 EDT 2013

Estebell - Tue Oct 22 09:22:17 EDT 2013

This is my corrected code :

Discussion SDiscussion
string smess = "La discussion en cours sera close"
Comment scomm
Object obj
 
for SDiscussion in obj do{
closeDiscussion (SDiscussion, obj, smess, scomm)
}
 
It runs without error, but the discussion is not closed yet!!
 
 

Do you assign obj to a specific Object first? When I added

Object obj = current

and ran it, it closed the discussion just fine for the current object...

 

OK, then the question is can you close the discussion manually? Everyone cannot close all discussions:

"An originator, database manager, or project manager can close a discussion."

So, are you

  1. The one who started the discussion?
  2. A user of the type Database Manager?
  3. Or a  user of the type Project Manager?

If not, that could be the problem.

/sekrbo

Re: Closing a Discussion
Estebell - Tue Oct 22 11:01:33 EDT 2013

sekrbo - Tue Oct 22 09:51:01 EDT 2013

Do you assign obj to a specific Object first? When I added

Object obj = current

and ran it, it closed the discussion just fine for the current object...

 

OK, then the question is can you close the discussion manually? Everyone cannot close all discussions:

"An originator, database manager, or project manager can close a discussion."

So, are you

  1. The one who started the discussion?
  2. A user of the type Database Manager?
  3. Or a  user of the type Project Manager?

If not, that could be the problem.

/sekrbo

Even if I assign obj to current object, the discussion does not close.

And I am the one who has started the discussion...

I really don't understand.

Re: Closing a Discussion
llandale - Tue Oct 22 12:38:25 EDT 2013

Estebell - Tue Oct 22 11:01:33 EDT 2013

Even if I assign obj to current object, the discussion does not close.

And I am the one who has started the discussion...

I really don't understand.

I wonder if you need to "refresh(m)" to SEE the closures.

Never used Discussions but I do read the manual.  I wonder if the "for d in obj" loop fails to notice Discussions you just created?  If so, try "getDiscussions(o)" or "getObjectDiscussions(m)" before the delete loop.

Inside your loop you should do this command

  • bool mayModifyDiscussionStatus(Discussion d, Module m)

Also check the Discussion "status" before attempting to close.

-Louie

Re: Closing a Discussion
kourosh - Tue Oct 22 14:46:14 EDT 2013

Estebell - Tue Oct 22 11:01:33 EDT 2013

Even if I assign obj to current object, the discussion does not close.

And I am the one who has started the discussion...

I really don't understand.

it worked for me as well, so try assigning a string to see if it return's an error...

Discussion SDiscussion
string err
string smess = "La discussion en cours sera close"
Comment scomm
Object obj = current
 
for SDiscussion in obj do{
err = closeDiscussion (SDiscussion, obj, smess, scomm)
print err "\n"
}

Re: Closing a Discussion
Estebell - Wed Oct 23 03:09:20 EDT 2013

Estebell - Tue Oct 22 11:01:33 EDT 2013

Even if I assign obj to current object, the discussion does not close.

And I am the one who has started the discussion...

I really don't understand.

Well, 

- the command mayModifyDiscussionStatus (Discussion d, Module m) returns TRUE.

-but the error string for closing discussion is "This operation can not be performed when there are unsaved changes in the module."

Then I think I'm stuck with discussions. I'd wanted to trigger on attributes to close these discussions... Do you agree with me ?

Re: Closing a Discussion
llandale - Wed Oct 23 09:55:27 EDT 2013

Estebell - Wed Oct 23 03:09:20 EDT 2013

Well, 

- the command mayModifyDiscussionStatus (Discussion d, Module m) returns TRUE.

-but the error string for closing discussion is "This operation can not be performed when there are unsaved changes in the module."

Then I think I'm stuck with discussions. I'd wanted to trigger on attributes to close these discussions... Do you agree with me ?

Nothing quite like printing error messages, eh?   lol

Sounds like the Discussion stuff requires you to <<save(mod)>> first.  I don't see that in the Using DOORS Help.

The fact that you need to load discussions makes me believe they are stored separately from the Module itself.  If so, it would create some havok if you added a Discussion to a newly created object, and then closed the module without saving.

-Louie

Re: Closing a Discussion
llandale - Wed Oct 23 10:12:44 EDT 2013

llandale - Wed Oct 23 09:55:27 EDT 2013

Nothing quite like printing error messages, eh?   lol

Sounds like the Discussion stuff requires you to <<save(mod)>> first.  I don't see that in the Using DOORS Help.

The fact that you need to load discussions makes me believe they are stored separately from the Module itself.  If so, it would create some havok if you added a Discussion to a newly created object, and then closed the module without saving.

-Louie

Or..

  • if (unsaved(mod)) //
  • then warningBox("Sorry, cannot close Discussions.  Save module 1st")
  • else{Proceed}

-Louie